$(function () {
	$.ajax({
		type: "get",
		url: DOMAIN + '/v1/enterprise' + isLogin,
		dataType: "json",
		async: true,
		success: function (result) {
			//
			if (result.status == 200) {
				var list = result.data[0];
				$('#id').val(list.id);
				$('#name').val(list.name);
				$('#contactPerson').val(list.contactPerson);
				$('#telephone').val(list.telephone);
				$('#telPhone').val(list.telPhone);
				$('#eMail').val(list.eMail);
				$('#fax').val(list.fax);
				$('#address').val(list.address);
				$('#defaultReceivingAddress').val(list.defaultReceivingAddress);
				$('#defaultDeliveryAddress').val(list.defaultDeliveryAddress);
			}
		}
	})

})

//保存企业档案信息
$("#enter-savetBtn").click(function () {
	//var data = $("#EnterForm").serialize();
	var data = getFormJsonObject($("#EnterForm"));
	data = JSON.stringify(data);
	$.ajax({
		type: "PATCH",
		url: DOMAIN + '/v1/enterprise/' + id + isLogin,
		dataType: "JSON",
		contentType: "application/JSON; charset=utf-8",
		data: data,
		async: true,
		success: function (result) {
			if (result.status == 200) {
				alert("保存成功");
			} else {
				alert("保存失败");
			}
		}
	})
})
